package org.openea.eap.module.obpm.service.form;

import org.openbpm.form.api.model.IFormDef;
import org.openbpm.form.api.service.FormService;
import org.openea.eap.module.obpm.model.form.FormDef;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;


@Service("formService")
public class DefaultFormService
        implements FormService {
    @Resource
    private FormDefManager formDefManager;

    public IFormDef getByFormKey(String formKey) {
        return (IFormDef) this.formDefManager.getByKey(formKey);
    }


    public IFormDef getByFormId(String formId) {
        return (IFormDef) this.formDefManager.get(formId);
    }


    public String getFormExportXml(Set<String> formKeys) {
        List<String> id = new ArrayList<>();
        for (String formKey : formKeys) {
            FormDef form = this.formDefManager.getByKey(formKey);
            id.add(form.getId());
        }


        return null;
    }

    public void importForm(String formXmlStr) {
    }
}
